package com.shuwen.gcdj.common.api;

/**
 * 枚举了一些常用API操作码
 * Created by 李东旭 on 2021/12/01.
 */
public enum ResultCode implements IErrorCode {
    SUCCESS(200, "操作成功"),
    FAILED(500, "操作失败"),
    UNAUTHORIZED(401, "暂未登录或token已经过期"),
    FORBIDDEN(404, "没有相关权限"),
    NOT_EXIST(404, "接口不存在"),
    VALIDATE_FAILED(405, "参数检验失败"),

    SQL_EXCEPTION(9001, "数据重复或违反约束规则"),

    MISSING_PARAMS(5000, "参数缺失"),
    PARAM_ERROR(5001, "参数异常"),
    DATA_NOT_EXIT(5002,"数据不存在"),
    DATA_EXIST(5003, "数据已存在"),

    TOKEN_UNAVAILABLE(5100, "TOKEN不可用"),
    USER_NOT_EXIST(5101, "用户不存在"),
    ACCOUNT_PASSWORD_MISMATCH(5102, "账号密码不匹配"),
    ILLEGAL_OPERATION(5103, "非法操作");

    private long code;
    private String message;

    private ResultCode(long code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public long getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
